#{extends 'main.html' /}<h2>${project.name} > Review Task Type</h2>
<hr/> #{form @TaskTypes.submitRequestReview(taskTypeIds,reviewFor,componentIds,project.getEntityId())}
<label>
    Select the task type:
</label>
<br/>
<br/>
#{list items:allTypes, as:'taskType'}<input type="checkbox" value="${taskType.getEntityId()}" name = "taskTypeIds">&nbsp;&nbsp;${taskType.type}
<br/>
<br/>
#{/list}
<label>
    Do you want to review for the whole project or certain components?
</label>
<br/>
<br/>
<br/>
<input type="radio" name="reviewFor" value = "project" onclick="disableCheckboxes()" checked="true"/>&nbsp;&nbsp;Project
<br/>
<br/>
#{if project.components.size()>1}
<input type="radio" name="reviewFor" value = "component" onclick="enableCheckboxes()"/>&nbsp;&nbsp;Component:
<br/>
<br/>
<div style="margin-left:30px">
    #{list items:project.components, as:'component'}
    #{if component.name!="Default component"}
    <input type="checkbox" value="${component.getEntityId()}" name = "componentIds" id = "componentIds" disabled="true">&nbsp;&nbsp;${component.name}
    <br/>
    <br/>
    #{/if}
    #{/list}
</div>
<br/>
<br/>
#{/if}
#{else}
<label style="font-size:15px">
    There are currently no components in the project
</label><br/><br/>
#{/else}<input type="submit" value="Request"/>
<script>
    function enableCheckboxes(){
        var components = document.getElementsByName("componentIds");
        for (var i = 0; i < components.length; i++) {
            components[i].disabled = false;
        }
    }
    
    function disableCheckboxes(){
        var components = document.getElementsByName("componentIds");
        for (var i = 0; i < components.length; i++) {
            components[i].disabled = true;
        }
    }
</script>
#{/form}